var http = require('http'),
	url = require('url'),
	router = require('./router');

http.createServer(function (req, res){
	res.writeHead(200, {'Content-Type':'text/html; charset=utf-8'});
	if(req.url != "/favicon.ico"){//清除二次访问
		// console.log(req.url);
		var pathname = url.parse(req.url).pathname;
		// console.log(pathname);
		pathname = pathname.replace(/\//, '');//替换掉路径前面的/ 
		// console.log(pathname);
		router[pathname](req, res);
		res.end('');//协议尾
	}
}).listen(8000);